<template>
  <div class="pages_content table">
    <el-container>
      <el-header>
        <breaDcrumb />
      </el-header>
      <el-main style="display: flex">
        <div>
          <div class="header_right" @click="showCardNav = !showCardNav">
            <div class="title">搜索</div>
            <div>
              <transition name="from"></transition>
              <span v-show="!showCardNav">
                <i style="margin-right: 5px" class="el-icon-arrow-down"></i>
              </span>
              <transition name="to"></transition>
              <span v-show="showCardNav">
                <i style="margin-right: 5px" class="el-icon-arrow-up"></i>
              </span>
            </div>
          </div>
          <div v-show="showCardNav" class="hr"></div>
          <el-collapse-transition>
            <div v-show="showCardNav">
              <div class="search">
                <span style="display: inline-block;margin-bottom: 10px;">
                  <span style="margin-right: 12px">站点</span>
                  <el-select v-model="tableParam.productionSiteId" multiple placeholder="请选择">
                    <el-option v-for="(item,index) in stationList" :key="index" :label="item.stationName" :value="item.id"></el-option>
                  </el-select>
                </span>
                <span style="margin-left: 24px">
                  <span style="margin-right: 12px">工程名称</span>
                  <el-select v-model="tableParam.enginnerrIds" placeholder="请选择" multiple>
                    <el-option v-for="(item,index) in engineeringManagementList" :key="index" :label="item.name" :value="item.id"></el-option>
                  </el-select>
                </span>
                <el-button icon="el-icon-search" size="medium" class="bottom_all" @click="(tableParam.page = 1, tableParam.enginnerrId=tableParam.enginnerrIds.join(',')), gettableData()">查 询</el-button>
                <el-button size="medium" class="bottom_all_two" style="margin-left: 12px" @click="init()">重 置</el-button>
              </div>
            </div>
          </el-collapse-transition>
          <div class="hr"></div>
          <div class="card" style="padding-top:15px">
            <div v-loading="tableLoading" class="card_info" :style="style">
              <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="tableData" tooltip-effect="dark">
                <template v-for="(item, index2) in table">
                  <el-table-column v-if="item.status" :key="index2" :label="item.label" align="center" :width="item.width">
                    <template slot-scope="scope">
                      <span>{{ scope.row[item.prop] }}</span>
                    </template>
                  </el-table-column>
                </template>
              </el-table>
            </div>
            <!-- <div class="card_bottom">
              <div class="card_bottom_left">
                <div class="top_page_totle">总共{{ total }}条</div>
                <el-pagination :current-page.sync="tableParam.page" :page-size="tableParam.pageSize" layout="prev, pager, next, jumper" :total="total" @current-change="gettableData()"></el-pagination>
              </div>
              <div>
                <el-button size="mini" icon="el-icon-refresh-right" class="bottom_all_two" @click="gettableData">刷新</el-button>
              </div>
            </div> -->
          </div>
        </div>
      </el-main>
      <div class="card_bottom">
        <div class="card_bottom_left">
          <div class="top_page_totle">总共{{ total }}条</div>
          <el-pagination :current-page.sync="tableParam.page" :page-size="tableParam.pageSize" layout="prev, pager, next, jumper" :total="total" @current-change="gettableData()"></el-pagination>
        </div>
        <div>
          <el-button size="mini" icon="el-icon-refresh-right" class="bottom_all_two" @click="gettableData">刷新</el-button>
        </div>
      </div>
    </el-container>
  </div>
</template>

<script>
import mixin from "@/mixins/ICPSmixin.js";
import {
  queryPage,
  station,
  engineeringManagement
} from "@/api/wise/internalunit.js";
export default {
  mixins: [mixin],
  data() {
    return {
      /*表格增删改查及下载接口*/
      queryPage: queryPage,
      /*表格数据*/
      table: [
        { label: "站点", width: "auto", prop: "staionName", status: true },
        { label: "工程名称", width: "auto", prop: "enginnerrName", status: true },
        { label: "订单数量", width: "auto", prop: "orderNumTotal", status: true },
        { label: "总票面量（方）", width: "auto", prop: "faceNumTotal", status: true },
        { label: "总签收量（方）", width: "auto", prop: "signNumTotal", status: true },
        { label: "差值（方）", width: "auto", prop: "differenceNumTotal", status: true },
      ],
      pagesType: 0,
      stationList: [],
      engineeringManagementList: []
    };
  },
  created() {
    /*存储拷贝的原初始化fromDate数据*/
    this.tableParam = { ...this.tableParam, productionSiteId: [], enginnerrId: '', enginnerrIds: [] };
    this.initData()
    this.gettableData();
  },
  /*
   *copy(data)深拷贝数据,返回拷贝完的数据
   *gettableData获取列表数据
   *load下载
   *SortNum保持序列号
   * UpdateOrDelete禁用，启用，删除
   * submitFromDate保存更新数据
   * this.$fromatTable(arr,data,'id','name')
   */
  methods: {
    /*重置数据*/
    init() {
      this.tableParam.productionSiteId = [];
      this.tableParam.enginnerrId = '';
      this.tableParam.enginnerrIds = [];
      this.gettableData();
    },
    initData() {
      let data = {
        page: 1,
        pageSize: 999999,
      }
      station(data).then(res => {
        this.stationList = res.data.data
        console.log(res.data)
      })
      engineeringManagement({ ...data, isAssess: 5 }).then(res => {
        this.engineeringManagementList = res.data.data
      })
    }
  },
};
</script>

<style lang="scss" scoped>
.el-input,
.el-select {
  width: 240px;
}
/*
 <el-link class="table_link" :underline="false">查看配合比</el-link>*/
.table_link {
  margin: 0 10px;
  color: $bg_color;
  cursor: pointer;
}

.table_link:hover {
  opacity: 0.8;
}
</style>
